<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('项目详情')"/>
    <th:block th:include="include :: select2-css"/>
</head>

<body>
<div class="main-content">
    <form class="form-horizontal" id="form-user-edit" th:object="${basFaultRecord}">

        <input name="id" type="hidden" th:field="*{id}"/>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">设备id：</label>
                    <div class="col-sm-8">
                        <input name="device_id" th:field="*{device_id}" placeholder="请输入设备id" class="form-control"
                               type="text" maxlength="30"
                               required>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">设备名称：</label>
                    <div class="col-sm-8">
                        <input name="device_name" th:field="*{device_name}" placeholder="请输入设备名称" class="form-control"
                               type="text" maxlength="30"
                               required>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">设备类型：</label>
                    <div class="col-sm-8">
                        <input name="device_type" th:field="*{device_type}" placeholder="请输入设备类型" class="form-control"
                               type="text" maxlength="30"
                               required>
                    </div>
                </div>
            </div>

            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label ">任务号：</label>
                    <div class="col-sm-8">
                        <input id="task_no" name="task_no" th:field="*{task_no}" placeholder="请输入任务号"
                               class="form-control"
                               type="text" maxlength="30" >
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label ">作业id：</label>
                    <div class="col-sm-8">
                        <input id="job_id" name="job_id" th:field="*{job_id}" placeholder="请输入作业id"
                               class="form-control"
                               type="text" maxlength="30" >
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label ">报警信息：</label>
                    <div class="col-sm-8">
                        <input id="fault" name="fault" th:field="*{fault}" placeholder="请输入报警信息"
                               class="form-control"
                               type="text" maxlength="30" >
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label ">报警开始时间：</label>
                    <div class="col-sm-8">
                        <input type="text" placeholder="请单击选择报警开始时间：" th:field="*{start_time}" name="start_time" id="startTime" class="form-control" />
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label ">结束时间：</label>
                    <div class="col-sm-8">
                        <input type="text" th:field="*{finish_time}"  placeholder="请单击选择报警结束时间：" name="finish_time" id="finishTime" class="form-control"/>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
<div class="row">
    <div class="col-sm-offset-5 col-sm-10">
        <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存
        </button>&nbsp;
        <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭
        </button>
    </div>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<script type="text/javascript">
    var prefix = ctx + "device/basFaultRecord";

    layui.use('laydate', function(){
        var laydates = layui.laydate;
        laydates.render({
            elem: '#startTime'
            ,type: 'datetime',
            /* ,range: '到' */
            format: 'yyyy-MM-dd HH:mm:ss'
        })
    })

    layui.use('laydate', function(){
        var laydates = layui.laydate;
        laydates.render({
            elem: '#finishTime'
            ,type: 'datetime',
            /* ,range: '到' */
            format: 'yyyy-MM-dd HH:mm:ss'
        })
    })
    function submitHandler() {
        if ($.validate.form()){
            var data = $("#form-user-edit").serializeArray();
            $.operate.save(prefix + "/edit", data);
        }
    }

</script>
</body>
</html>